Page({
    data: {
        fileList: [],
    },

    afterRead(event) {
        const { file } = event.detail;
        let fileList = file.map(item => {
            return { url: item.url }
        })
        this.setData({
            fileList
        })


    },
    async doUpload() {
        let arr = this.data.fileList.map(item => {
            let ext = /\.[^\.]\w*$/.exec(item.url)[0]

            let cloudPath = "test/" + new Date().getTime() + Math.floor(Math.random() * 100) + ext
            return wx.cloud.uploadFile({
                cloudPath: cloudPath,
                filePath: item.url
            })
        })
        let result = await Promise.all(arr)
        console.log(result)


    }
});
